package com.labyrinth.core;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.GL10;

/**
 * Created by IntelliJ IDEA.
 * User: kristofer
 * Date: 31.10.2011
 * Time: 13:44:02
 * To change this template use File | Settings | File Templates.
 */
public class levelX extends Button
{
    int number;
    private final Clock LvNr1;
    private final Clock LvNr2;
    private final Clock LvNr3;



    public levelX(float x, float y, String Texture)
    {
        super(x, y);
        this.setScale(50,160);
        setDrawType(GL10.GL_TRIANGLE_STRIP);
        setTexture(Texture);
        //name = Texture;
        setMesh();

        LvNr3 = new Clock(x, y+70, 1);
        LvNr2 = new Clock(x, y+50, 2);
        LvNr1 = new Clock(x, y+30, 3);

        number = 1;
    }

    public void SetNumber(int timer)
    {
        number = timer;
        LvNr1.setClock(timer);
        LvNr2.setClock(timer);
        LvNr3.setClock(timer);
    }


    public void drawX()
    {
        
        Gdx.gl10.glPushMatrix();
        Gdx.gl10.glTranslatef(position.getX(), position.getY(), 0);
        Gdx.gl10.glScalef(scaleX, scaleY, 0);
        Gdx.graphics.getGL10().glEnable(GL10.GL_TEXTURE_2D);
        texture.bind();
        mesh.render(drawType, 0, vertexCount);
        Gdx.gl10.glPopMatrix();
        LvNr1.draw();
        LvNr2.draw();
        LvNr3.draw();
    }
    public boolean clickedX(float X,float Y)
    {
        float BX = this.getX();
        float BY = this.getY();

        if((X <= BX+this.getScaleX()/2)&& (X > BX-this.getScaleX()/2))
        {
            if((Y <= BY+this.getScaleY()/2)&& (Y > BY-this.getScaleY()/2))
            {
                return false;
            }
        }
        return true;
    }


}
